package com.qiniu;

import com.qiniu.util.Auth;

public class DownloadDemo {
	// 设置好账号的ACCESS_KEY和SECRET_KEY
	String ACCESS_KEY = "NdiaXA5lcdG3Ig4abDxp2WWddJ_pxa67biDNj_QA";
	String SECRET_KEY = "SbQ0zTOw-W0fHdMtjNzTdM1YQss_XlLex8uFv5jQ";
	// 密钥配置
	Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY);
	// 构造私有空间的需要生成的下载的链接
	String URL = "http://qroom.anxinyisheng.com/Fi635KDBB_4racgWJw6M879tBO4U";

	String key = "Fi635KDBB_4racgWJw6M879tBO4U";

	public String download() {
		// 调用privateDownloadUrl方法生成下载链接,第二个参数可以设置Token的过期时间
		String downloadRUL = auth.privateDownloadUrl(URL, 3600);
		System.out.println(downloadRUL);
		return downloadRUL;
	}
//http://qroom.anxinyisheng.com?e=1471319247&token=NdiaXA5lcdG3Ig4abDxp2WWddJ_pxa67biDNj_QA:se5IOt5U5UL_KkgApHm52zym5_A=&key=Fi635KDBB_4racgWJw6M879tBO4U

	public static void main(String args[]) {
		String url = new DownloadDemo().download();
	}
}